package date_simpledateformat_APIdemo;

import java.util.Calendar;

/**
 * @author ChenYongHao
 * @date 2023/4/28 9:23
 * @desc
 */
public class Calendar_APIdemo {
    public static void main(String[] args) {
        Calendar c = Calendar.getInstance();
        int year = c.get(Calendar.YEAR);
        int month = c.get(Calendar.MONTH) + 1;
        int day = c.get(Calendar.DATE);
        int hour = c.get(Calendar.HOUR);
        int minute = c.get(Calendar.MINUTE);
        int second = c.get(Calendar.SECOND);
        System.out.println(year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second);

    }

}
